<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Make Controller Kit - Firmware API: OSC API</title>
<link href="mt_doxygen.css" rel="stylesheet" type="text/css" />
<link href="../resources/mt_doxytabs.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.header {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12pt;
	color: #222222;
}
-->
</style>
</head>

<body>
<table width="800" border="0">
    <tr>
      <td colspan="3">
        <form method="get" action="http://www.google.com/search">
          <div align="right">
            <input type="text"   name="q" size="25"
              maxlength="255" value="" />
            <input type="submit" value="Search" />
            <input type="hidden" name="sitesearch" value="makingthings.com/ref/firmware/html" />
          </div>
        </form>
       </td>
    </tr>
    <tr>
      <td><div align="center"><a href="http://www.makingthings.com">
				<img src="../resources/logo_brown_medium.png" alt="MakingThings"
									width="200" height="78" border="0" align="middle" longdesc="http://www.makingthings.com" /></a></div></td>
				<td><div align="center" class="header">
      		Make Controller Kit <br />
          Firmware API
      </div></td>
      <td><div align="center"><a href="http://www.makezine.com">
					<img src="../resources/make_logo.png" alt="MAKE Zine" 
										width="164" height="73" border="0" align="middle" longdesc="http://www.makezine.com" /></a></div></td>
    </tr>
</table>
</body>
</html>
<!-- Generated by Doxygen 1.5.4 -->
<script type="text/javascript">
<!--
function changeDisplayState (e){
  var num=this.id.replace(/[^[0-9]/g,'');
  var button=this.firstChild;
  var sectionDiv=document.getElementById('dynsection'+num);
  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
    sectionDiv.style.display='block';
    button.src='open.gif';
  }else{
    sectionDiv.style.display='none';
    button.src='closed.gif';
  }
}
function initDynSections(){
  var divs=document.getElementsByTagName('div');
  var sectionCounter=1;
  for(var i=0;i<divs.length-1;i++){
    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
      var header=divs[i];
      var section=divs[i+1];
      var button=header.firstChild;
      if (button!='IMG'){
        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
        button=document.createElement('img');
        divs[i].insertBefore(button,divs[i].firstChild);
      }
      header.style.cursor='pointer';
      header.onclick=changeDisplayState;
      header.id='dynheader'+sectionCounter;
      button.src='closed.gif';
      section.id='dynsection'+sectionCounter;
      section.style.display='none';
      section.style.marginLeft='14px';
      sectionCounter++;
    }
  }
}
window.onload = initDynSections;
-->
</script>
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="classes.html"><span>Data&nbsp;Structures</span></a></li>
    <li><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul>
</div>
<h1>OSC API<br>
<small>
[<a class="el" href="group___controller.html">Controller</a>]</small>
</h1>Make use of the OSC infrastructure for your own subsystems.  
<a href="#_details">More...</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___o_s_c_a_p_i.html#g75a7ad99079437eb1b12ea25752540af">Osc_RegisterSubsystem</a> (const char *name, int(*subsystem_ReceiveMessage)(int channel, char *buffer, int length), int(*subsystem_Async)(int channel))</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Register your subsystem with the OSC system.  <a href="#g75a7ad99079437eb1b12ea25752540af"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___o_s_c_a_p_i.html#g852200f3d0612d90d73e9f233392ec2d">Osc_SubsystemError</a> (int channel, char *subsystem, char *string)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Send an error back via OSC from your subsystem.  <a href="#g852200f3d0612d90d73e9f233392ec2d"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___o_s_c_a_p_i.html#g52a8d83512751817b3a4f9f123495fb0">Osc_BlobReceiverHelper</a> (int channel, char *message, int length, char *subsystemName, int(*blobPropertySet)(int property, uchar *buffer, int length), int(*blobPropertyGet)(int property, uchar *buffer, int size), char *blobPropertyNames[])</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Receive an OSC blob for a subsystem with no indexes.  <a href="#g52a8d83512751817b3a4f9f123495fb0"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___o_s_c_a_p_i.html#gd6d4ee5a60624c22a31e0b59e560326c">Osc_IndexBlobReceiverHelper</a> (int channel, char *message, int length, int indexCount, char *subsystemName, int(*blobPropertySet)(int index, int property, uchar *buffer, int length), int(*blobPropertyGet)(int index, int property, uchar *buffer, int length), char *blobPropertyNames[])</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Receive an OSC blob for a subsystem with indexes.  <a href="#gd6d4ee5a60624c22a31e0b59e560326c"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___o_s_c_a_p_i.html#g9331ca23d8e81ba91c4e728f0470627e">Osc_IntReceiverHelper</a> (int channel, char *message, int length, char *subsystemName, int(*propertySet)(int property, int value), int(*propertyGet)(int property), char *propertyNames[])</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Receive an integer for a subsystem with no indexes.  <a href="#g9331ca23d8e81ba91c4e728f0470627e"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___o_s_c_a_p_i.html#gbb24f5e4a4c94eef2c321020941c45b3">Osc_GeneralReceiverHelper</a> (int channel, char *message, int length, char *subsystemName, int(*propertySet)(int property, char *typedata, int channel), int(*propertyGet)(int property, int channel), char *propertyNames[])</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Receive data for a subsystem that receives a variety of different data types.  <a href="#gbb24f5e4a4c94eef2c321020941c45b3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___o_s_c_a_p_i.html#gdaa5a3868eeedcf785c3d52f6b36ef34">Osc_IndexIntReceiverHelper</a> (int channel, char *message, int length, int indexCount, char *subsystemName, int(*propertySet)(int index, int property, int value), int(*propertyGet)(int index, int property), char *propertyNames[])</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Receive integers for a subsystem with multiple indexes.  <a href="#gdaa5a3868eeedcf785c3d52f6b36ef34"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Make use of the OSC infrastructure for your own subsystems. 
<p>
You can use the existing OSC infrastructure to create your own OSC subsystems. It's expected that you'll have a few things lined up to use this API:<ol type=1>
<li>The name of your subsystem</li><li>The properties that your subsystem will support. This must be in an array with '0' as the last element.</li><li>Getters and setters for each of those properties and functions to call them by property index.</li><li>A function to call the correct helper when Osc calls you.</li><li>Finally, once you've done all this, you'll need to add your subsystem to the list that Osc knows about.</li></ol>
<p>
<dl class="user" compact><dt><b>Example</b></dt><dd>So this might look something like: <div class="fragment"><pre class="fragment">  <span class="comment">// our system name and a function to get it</span>
  <span class="keyword">static</span> <span class="keywordtype">char</span>* MySubsystemOsc_Name = <span class="stringliteral">"my-system"</span>;
  <span class="keyword">const</span> <span class="keywordtype">char</span>* MySubsystemOsc_GetName( <span class="keywordtype">void</span> )
  {
    <span class="keywordflow">return</span> MySubsystemOsc_Name;
  }
  
  <span class="comment">// our property names</span>
  <span class="keyword">static</span> <span class="keywordtype">char</span>* MySubsystemOsc_PropertyNames[] = { <span class="stringliteral">"prop0"</span>, <span class="stringliteral">"prop1"</span>, 0 }; <span class="comment">// must end with a zero</span>
  
  <span class="comment">// A getter and setter, each dealing with the property given to us by the OSC system</span>
  <span class="keywordtype">int</span> MyGPSOsc_PropertySet( <span class="keywordtype">int</span> index, <span class="keywordtype">int</span> property, <span class="keywordtype">int</span> value )   
  {
    <span class="keywordflow">switch</span> ( property )     
    {       
      <span class="keywordflow">case</span> 0:         
        MySubsystem_SetProperty0( index, value );
        <span class="keywordflow">break</span>;
      <span class="keywordflow">case</span> 1:
        MySubsystem_SetProperty1( index, value );
        <span class="keywordflow">break</span>;
     }
    <span class="keywordflow">return</span> <a class="code" href="group___error.html#gaa42bc036fbba18487ae9a15cd1f2f94" title="All&amp;#39;s well here.">CONTROLLER_OK</a>;
  }

  <span class="keywordtype">int</span> MySubsystemOsc_PropertyGet( <span class="keywordtype">int</span> index, <span class="keywordtype">int</span> property )
  {
    <span class="keywordtype">int</span> value;
     <span class="keywordflow">switch</span> ( property )
     {
      <span class="keywordflow">case</span> 0:
        value = MySubsystem_GetProperty0( index );
        <span class="keywordflow">break</span>;
      <span class="keywordflow">case</span> 1:
        value = MySubsystem_GetProperty1( index );
        <span class="keywordflow">break</span>;
    }
    <span class="keywordflow">return</span> value;
  }
  
  <span class="comment">// this is called when the OSC system determines an incoming message is for you.</span>
  <span class="keywordtype">int</span> MySubsystemOsc_ReceiveMessage( <span class="keywordtype">int</span> channel, <span class="keywordtype">char</span>* message, <span class="keywordtype">int</span> length )
  {  
     <span class="comment">// depending on your subsystem, use one of the OSC helpers to parse the incoming message</span>
     <span class="keywordflow">return</span> Osc_IndexGeneralReceiverHelper( channel, message, length,
                                        MySubsystemOsc_Name,
                                        MySubsystemOsc_PropertySet,
                                        MySubsystemOsc_PropertyGet,
                                        MySubsystemOsc_PropertyNames );
  }
   
  <span class="comment">// lastly, we'll need to register our system with OSC</span>
  Run( ) <span class="comment">// this is our startup task in make.c</span>
  {
    <span class="comment">// other startup stuff</span>
    <a class="code" href="group___o_s_c_a_p_i.html#g75a7ad99079437eb1b12ea25752540af" title="Register your subsystem with the OSC system.">Osc_RegisterSubsystem</a>( MySubsystemOsc_GetName(), MySubsystemOsc_ReceiveMessage, NULL );
  }
</pre></div></dd></dl>
Check the how-to at <a href="http://www.makingthings.com/documentation/how-to/create-your-own-osc-subsystem">http://www.makingthings.com/documentation/how-to/create-your-own-osc-subsystem</a> for details. <hr><h2>Function Documentation</h2>
<a class="anchor" name="g52a8d83512751817b3a4f9f123495fb0"></a><!-- doxytag: member="osc.c::Osc_BlobReceiverHelper" ref="g52a8d83512751817b3a4f9f123495fb0" args="(int channel, char *message, int length, char *subsystemName, int(*blobPropertySet)(int property, uchar *buffer, int length), int(*blobPropertyGet)(int property, uchar *buffer, int size), char *blobPropertyNames[])" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Osc_BlobReceiverHelper           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>channel</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>message</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>subsystemName</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int(*)(int property, uchar *buffer, int length)&nbsp;</td>
          <td class="paramname"> <em>blobPropertySet</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int(*)(int property, uchar *buffer, int size)&nbsp;</td>
          <td class="paramname"> <em>blobPropertyGet</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>blobPropertyNames</em>[]</td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Receive an OSC blob for a subsystem with no indexes. 
<p>
You'll usually want to call this when the OSC system calls you with a new message. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>channel</em>&nbsp;</td><td>An index for which OSC channel is being used (usually USB or Ethernet). Usually provided for you by the OSC system. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>message</em>&nbsp;</td><td>The OSC message being received. Usually provided for you by the OSC system. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>length</em>&nbsp;</td><td>The length of the incoming message. Usually provided for you by the OSC system. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>subsystemName</em>&nbsp;</td><td>The name of your subsystem. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>blobPropertySet</em>&nbsp;</td><td>A pointer to the function to be called in order to write a property of your subsystem. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>blobPropertyGet</em>&nbsp;</td><td>A pointer to the function to be called in order to read a property of your subsystem. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>blobPropertyNames</em>&nbsp;</td><td>An array of all the property names in your subsystem.</td></tr>
  </table>
</dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <span class="comment">// this is where OSC calls us when an incoming message for us has arrived</span>
  <span class="keywordtype">int</span> MySubsystemOsc_ReceiveMessage( <span class="keywordtype">int</span> channel, <span class="keywordtype">char</span>* message, <span class="keywordtype">int</span> length )
  {
    <span class="keywordtype">int</span> status = <a class="code" href="group___o_s_c_a_p_i.html#g52a8d83512751817b3a4f9f123495fb0" title="Receive an OSC blob for a subsystem with no indexes.">Osc_BlobReceiverHelper</a>( channel, message, length, 
                                      MySubsystemOsc_Name,
                                      MySubsystemOsc_BlobPropertySet, MySubsystemOsc_BlobPropertyGet, 
                                      MySubsystemOsc_BlobPropertyNames );                        

    <span class="keywordflow">if</span> ( status != <a class="code" href="group___error.html#gaa42bc036fbba18487ae9a15cd1f2f94" title="All&amp;#39;s well here.">CONTROLLER_OK</a> )
      <span class="keywordflow">return</span> Osc_SendError( channel, MySubsystemOsc_Name, status );
    <span class="keywordflow">return</span> <a class="code" href="group___error.html#gaa42bc036fbba18487ae9a15cd1f2f94" title="All&amp;#39;s well here.">CONTROLLER_OK</a>;
  }
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="osc_8c-source.html#l00831">831</a> of file <a class="el" href="osc_8c-source.html">osc.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="gbb24f5e4a4c94eef2c321020941c45b3"></a><!-- doxytag: member="osc.c::Osc_GeneralReceiverHelper" ref="gbb24f5e4a4c94eef2c321020941c45b3" args="(int channel, char *message, int length, char *subsystemName, int(*propertySet)(int property, char *typedata, int channel), int(*propertyGet)(int property, int channel), char *propertyNames[])" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Osc_GeneralReceiverHelper           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>channel</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>message</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>subsystemName</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int(*)(int property, char *typedata, int channel)&nbsp;</td>
          <td class="paramname"> <em>propertySet</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int(*)(int property, int channel)&nbsp;</td>
          <td class="paramname"> <em>propertyGet</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>propertyNames</em>[]</td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Receive data for a subsystem that receives a variety of different data types. 
<p>
An example of this kind of situation is the network system - you have a variety of different properties, several of which are both ints and strings.<p>
You'll usually want to call this when the OSC system calls you with a new message. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>channel</em>&nbsp;</td><td>An index for which OSC channel is being used (usually USB or Ethernet). Usually provided for you by the OSC system. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>message</em>&nbsp;</td><td>The OSC message being received. Usually provided for you by the OSC system. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>length</em>&nbsp;</td><td>The length of the incoming message. Usually provided for you by the OSC system. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>subsystemName</em>&nbsp;</td><td>The name of your subsystem. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>propertySet</em>&nbsp;</td><td>A pointer to the function to be called in order to write a property of your subsystem. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>propertyGet</em>&nbsp;</td><td>A pointer to the function to be called in order to read a property of your subsystem. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>propertyNames</em>&nbsp;</td><td>An array of all the property names in your subsystem.</td></tr>
  </table>
</dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <span class="comment">// this is where OSC calls us when an incoming message for us has arrived</span>
  <span class="keywordtype">int</span> MySubsystemOsc_ReceiveMessage( <span class="keywordtype">int</span> channel, <span class="keywordtype">char</span>* message, <span class="keywordtype">int</span> length )
  {
    <span class="keywordtype">int</span> status = <a class="code" href="group___o_s_c_a_p_i.html#gbb24f5e4a4c94eef2c321020941c45b3" title="Receive data for a subsystem that receives a variety of different data types.">Osc_GeneralReceiverHelper</a>( channel, message, length,
                                        MySubsystemOsc_Name,
                                        MySubsystemOsc_PropertySet, MySubsystemOsc_PropertyGet, 
                                        MySubsystemOsc_PropertyNames );

    <span class="keywordflow">if</span> ( status != <a class="code" href="group___error.html#gaa42bc036fbba18487ae9a15cd1f2f94" title="All&amp;#39;s well here.">CONTROLLER_OK</a> )
      <span class="keywordflow">return</span> Osc_SendError( channel, MySubsystemOsc_Name, status );
    <span class="keywordflow">return</span> <a class="code" href="group___error.html#gaa42bc036fbba18487ae9a15cd1f2f94" title="All&amp;#39;s well here.">CONTROLLER_OK</a>;
  }
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="osc_8c-source.html#l01191">1191</a> of file <a class="el" href="osc_8c-source.html">osc.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="gd6d4ee5a60624c22a31e0b59e560326c"></a><!-- doxytag: member="osc.c::Osc_IndexBlobReceiverHelper" ref="gd6d4ee5a60624c22a31e0b59e560326c" args="(int channel, char *message, int length, int indexCount, char *subsystemName, int(*blobPropertySet)(int index, int property, uchar *buffer, int length), int(*blobPropertyGet)(int index, int property, uchar *buffer, int length), char *blobPropertyNames[])" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Osc_IndexBlobReceiverHelper           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>channel</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>message</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>indexCount</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>subsystemName</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int(*)(int index, int property, uchar *buffer, int length)&nbsp;</td>
          <td class="paramname"> <em>blobPropertySet</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int(*)(int index, int property, uchar *buffer, int length)&nbsp;</td>
          <td class="paramname"> <em>blobPropertyGet</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>blobPropertyNames</em>[]</td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Receive an OSC blob for a subsystem with indexes. 
<p>
You'll usually want to call this when the OSC system calls you with a new message. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>channel</em>&nbsp;</td><td>An index for which OSC channel is being used (usually USB or Ethernet). Usually provided for you by the OSC system. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>message</em>&nbsp;</td><td>The OSC message being received. Usually provided for you by the OSC system. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>length</em>&nbsp;</td><td>The length of the incoming message. Usually provided for you by the OSC system. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>indexCount</em>&nbsp;</td><td>The number of indexes in your subsystem. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>subsystemName</em>&nbsp;</td><td>The name of your subsystem. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>blobPropertySet</em>&nbsp;</td><td>A pointer to the function to be called in order to write a property of your subsystem. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>blobPropertyGet</em>&nbsp;</td><td>A pointer to the function to be called in order to read a property of your subsystem. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>blobPropertyNames</em>&nbsp;</td><td>An array of all the property names in your subsystem.</td></tr>
  </table>
</dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <span class="comment">// this is where OSC calls us when an incoming message for us has arrived</span>
  <span class="keywordtype">int</span> MySubsystemOsc_ReceiveMessage( <span class="keywordtype">int</span> channel, <span class="keywordtype">char</span>* message, <span class="keywordtype">int</span> length )
  {
    <span class="keywordtype">int</span> status = <a class="code" href="group___o_s_c_a_p_i.html#gd6d4ee5a60624c22a31e0b59e560326c" title="Receive an OSC blob for a subsystem with indexes.">Osc_IndexBlobReceiverHelper</a>( channel, message, length, 2,
                                        MySubsystemOsc_Name,
                                        MySubsystemOsc_BlobPropertySet, MySubsystemOsc_BlobPropertyGet, 
                                        MySubsystemOsc_BlobPropertyNames );

    <span class="keywordflow">if</span> ( status != <a class="code" href="group___error.html#gaa42bc036fbba18487ae9a15cd1f2f94" title="All&amp;#39;s well here.">CONTROLLER_OK</a> )
      <span class="keywordflow">return</span> Osc_SendError( channel, MySubsystemOsc_Name, status );
    <span class="keywordflow">return</span> <a class="code" href="group___error.html#gaa42bc036fbba18487ae9a15cd1f2f94" title="All&amp;#39;s well here.">CONTROLLER_OK</a>;
  }
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="osc_8c-source.html#l00929">929</a> of file <a class="el" href="osc_8c-source.html">osc.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="gdaa5a3868eeedcf785c3d52f6b36ef34"></a><!-- doxytag: member="osc.c::Osc_IndexIntReceiverHelper" ref="gdaa5a3868eeedcf785c3d52f6b36ef34" args="(int channel, char *message, int length, int indexCount, char *subsystemName, int(*propertySet)(int index, int property, int value), int(*propertyGet)(int index, int property), char *propertyNames[])" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Osc_IndexIntReceiverHelper           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>channel</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>message</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>indexCount</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>subsystemName</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int(*)(int index, int property, int value)&nbsp;</td>
          <td class="paramname"> <em>propertySet</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int(*)(int index, int property)&nbsp;</td>
          <td class="paramname"> <em>propertyGet</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>propertyNames</em>[]</td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Receive integers for a subsystem with multiple indexes. 
<p>
An example of this kind of situation is the analog in system - you have 8 channels (indexes) and you're only going to be receiving integers.<p>
You'll usually want to call this when the OSC system calls you with a new message. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>channel</em>&nbsp;</td><td>An index for which OSC channel is being used (usually USB or Ethernet). Usually provided for you by the OSC system. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>message</em>&nbsp;</td><td>The OSC message being received. Usually provided for you by the OSC system. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>length</em>&nbsp;</td><td>The length of the incoming message. Usually provided for you by the OSC system. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>indexCount</em>&nbsp;</td><td>The number of indexes in your subsystem. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>subsystemName</em>&nbsp;</td><td>The name of your subsystem. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>propertySet</em>&nbsp;</td><td>A pointer to the function to be called in order to write a property of your subsystem. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>propertyGet</em>&nbsp;</td><td>A pointer to the function to be called in order to read a property of your subsystem. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>propertyNames</em>&nbsp;</td><td>An array of all the property names in your subsystem.</td></tr>
  </table>
</dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <span class="comment">// this is where OSC calls us when an incoming message for us has arrived</span>
  <span class="keywordtype">int</span> MySubsystemOsc_ReceiveMessage( <span class="keywordtype">int</span> channel, <span class="keywordtype">char</span>* message, <span class="keywordtype">int</span> length )
  {
    <span class="keywordtype">int</span> status = <a class="code" href="group___o_s_c_a_p_i.html#gbb24f5e4a4c94eef2c321020941c45b3" title="Receive data for a subsystem that receives a variety of different data types.">Osc_GeneralReceiverHelper</a>( channel, message, length,
                                        5, <span class="comment">// our index count</span>
                                        MySubsystemOsc_Name,
                                        MySubsystemOsc_PropertySet, MySubsystemOsc_PropertyGet, 
                                        MySubsystemOsc_PropertyNames );

    <span class="keywordflow">if</span> ( status != <a class="code" href="group___error.html#gaa42bc036fbba18487ae9a15cd1f2f94" title="All&amp;#39;s well here.">CONTROLLER_OK</a> )
      <span class="keywordflow">return</span> Osc_SendError( channel, MySubsystemOsc_Name, status );
    <span class="keywordflow">return</span> <a class="code" href="group___error.html#gaa42bc036fbba18487ae9a15cd1f2f94" title="All&amp;#39;s well here.">CONTROLLER_OK</a>;
  }
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="osc_8c-source.html#l01295">1295</a> of file <a class="el" href="osc_8c-source.html">osc.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g9331ca23d8e81ba91c4e728f0470627e"></a><!-- doxytag: member="osc.c::Osc_IntReceiverHelper" ref="g9331ca23d8e81ba91c4e728f0470627e" args="(int channel, char *message, int length, char *subsystemName, int(*propertySet)(int property, int value), int(*propertyGet)(int property), char *propertyNames[])" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Osc_IntReceiverHelper           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>channel</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>message</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>subsystemName</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int(*)(int property, int value)&nbsp;</td>
          <td class="paramname"> <em>propertySet</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int(*)(int property)&nbsp;</td>
          <td class="paramname"> <em>propertyGet</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>propertyNames</em>[]</td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Receive an integer for a subsystem with no indexes. 
<p>
You'll usually want to call this when the OSC system calls you with a new message. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>channel</em>&nbsp;</td><td>An index for which OSC channel is being used (usually USB or Ethernet). Usually provided for you by the OSC system. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>message</em>&nbsp;</td><td>The OSC message being received. Usually provided for you by the OSC system. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>length</em>&nbsp;</td><td>The length of the incoming message. Usually provided for you by the OSC system. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>subsystemName</em>&nbsp;</td><td>The name of your subsystem. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>propertySet</em>&nbsp;</td><td>A pointer to the function to be called in order to write a property of your subsystem. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>propertyGet</em>&nbsp;</td><td>A pointer to the function to be called in order to read a property of your subsystem. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>propertyNames</em>&nbsp;</td><td>An array of all the property names in your subsystem.</td></tr>
  </table>
</dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <span class="comment">// this is where OSC calls us when an incoming message for us has arrived</span>
  <span class="keywordtype">int</span> MySubsystemOsc_ReceiveMessage( <span class="keywordtype">int</span> channel, <span class="keywordtype">char</span>* message, <span class="keywordtype">int</span> length )
  {
    <span class="keywordtype">int</span> status = <a class="code" href="group___o_s_c_a_p_i.html#g9331ca23d8e81ba91c4e728f0470627e" title="Receive an integer for a subsystem with no indexes.">Osc_IntReceiverHelper</a>( channel, message, length,
                                        MySubsystemOsc_Name,
                                        MySubsystemOsc_PropertySet, MySubsystemOsc_PropertyGet, 
                                        MySubsystemOsc_PropertyNames );

    <span class="keywordflow">if</span> ( status != <a class="code" href="group___error.html#gaa42bc036fbba18487ae9a15cd1f2f94" title="All&amp;#39;s well here.">CONTROLLER_OK</a> )
      <span class="keywordflow">return</span> Osc_SendError( channel, MySubsystemOsc_Name, status );
    <span class="keywordflow">return</span> <a class="code" href="group___error.html#gaa42bc036fbba18487ae9a15cd1f2f94" title="All&amp;#39;s well here.">CONTROLLER_OK</a>;
  }
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="osc_8c-source.html#l01083">1083</a> of file <a class="el" href="osc_8c-source.html">osc.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g75a7ad99079437eb1b12ea25752540af"></a><!-- doxytag: member="osc.c::Osc_RegisterSubsystem" ref="g75a7ad99079437eb1b12ea25752540af" args="(const char *name, int(*subsystem_ReceiveMessage)(int channel, char *buffer, int length), int(*subsystem_Async)(int channel))" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Osc_RegisterSubsystem           </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int(*)(int channel, char *buffer, int length)&nbsp;</td>
          <td class="paramname"> <em>subsystem_ReceiveMessage</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int(*)(int channel)&nbsp;</td>
          <td class="paramname"> <em>subsystem_Async</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Register your subsystem with the OSC system. 
<p>
You'll usually want to do this on startup. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>name</em>&nbsp;</td><td>The name of your subsystem. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>subsystem_ReceiveMessage</em>&nbsp;</td><td>The function to call when an OSC message for this subsystem has arrived. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>subsystem_Async</em>&nbsp;</td><td>The function to be called by the OSC Async system. This is a task that will call you at regular intervals, if enabled, so you can check for status changes and send a message out automatically if you like. See the analog in source for an example. Pass in NULL if you don't want to use the Async system.</td></tr>
  </table>
</dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  Run( ) <span class="comment">// this is our startup task in make.c</span>
  {
    <span class="comment">// other startup stuff</span>
    <a class="code" href="group___o_s_c_a_p_i.html#g75a7ad99079437eb1b12ea25752540af" title="Register your subsystem with the OSC system.">Osc_RegisterSubsystem</a>( MySubsystemOsc_GetName(), MySubsystemOsc_ReceiveMessage, NULL );
  }
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="osc_8c-source.html#l00752">752</a> of file <a class="el" href="osc_8c-source.html">osc.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g852200f3d0612d90d73e9f233392ec2d"></a><!-- doxytag: member="osc.c::Osc_SubsystemError" ref="g852200f3d0612d90d73e9f233392ec2d" args="(int channel, char *subsystem, char *string)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Osc_SubsystemError           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>channel</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>subsystem</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>string</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Send an error back via OSC from your subsystem. 
<p>
You'll usually want to call this when the OSC system calls you with a new message, you've tried to parse it, and you've gotten an error. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>channel</em>&nbsp;</td><td>An index for which OSC channel is being used (usually USB or Ethernet). Usually provided for you by the OSC system. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>subsystem</em>&nbsp;</td><td>The name of the subsystem sending the error. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>string</em>&nbsp;</td><td>The actual contents of the error message.</td></tr>
  </table>
</dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <span class="comment">// this is where OSC calls us when an incoming message for us has arrived</span>
  <span class="keywordtype">int</span> MySubsystemOsc_ReceiveMessage( <span class="keywordtype">int</span> channel, <span class="keywordtype">char</span>* message, <span class="keywordtype">int</span> length )
  {
    <span class="keywordtype">int</span> status = <a class="code" href="group___o_s_c_a_p_i.html#g9331ca23d8e81ba91c4e728f0470627e" title="Receive an integer for a subsystem with no indexes.">Osc_IntReceiverHelper</a>( channel, message, length,
                                        MySubsystemOsc_Name,
                                        MySubsystemOsc_PropertySet, MySubsystemOsc_PropertyGet, 
                                        MySubsystemOsc_PropertyNames );

    <span class="keywordflow">if</span> ( status != <a class="code" href="group___error.html#gaa42bc036fbba18487ae9a15cd1f2f94" title="All&amp;#39;s well here.">CONTROLLER_OK</a> )
      <a class="code" href="group___o_s_c_a_p_i.html#g852200f3d0612d90d73e9f233392ec2d" title="Send an error back via OSC from your subsystem.">Osc_SubsystemError</a>( channel, MySubsystemOsc_Name, <span class="stringliteral">"Oh no. Bad data."</span> );
  }
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="osc_8c-source.html#l00791">791</a> of file <a class="el" href="osc_8c-source.html">osc.c</a>.</p>

</div>
</div><p>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Make Controller Kit</title>
<style type="text/css">
<!--
.footer {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9pt;
	color: #999999;
}
-->
</style>
</head>

<body>
<hr size="1">
<div>
  <p class="footer">The Make Controller Kit is an open source project maintained by <a href="http://www.makingthings.com">MakingThings</a>.<br />
    MakingThings code is released under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank">Apache 2.0 license</a>.<br />
    Bug tracker, development wiki and status can be found at <a href="http://dev.makingthings.com">http://dev.makingthings.com</a>.<br />
		This document was last updated on 5 Dec 2007.
</p>
</div>
<!-- Google Analytics Code -->
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-769030-1";
urchinTracker();
</script>
</body>
</html>
